/*
 * Copyright 2008-2023 dexian.vip. All rights reserved.
 * Support: http://www.dexian.vip
 * License: http://www.dexian.vip/license
 */

package vip.dexian.admin.assembler;

import vip.dexian.admin.dto.DepartmentDTO;
import vip.dexian.admin.entity.Department;
import vip.dexian.core.base.mapstruct.BaseEntityToDTOAssembler;
import org.mapstruct.Builder;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
 * 部门DTO转换
 *
 * @author 挺好的 2023年05月31日 10:02
 */
@Mapper (componentModel = "spring", builder = @Builder (disableBuilder = true))
public abstract class DepartmentDTOAssembler extends BaseEntityToDTOAssembler <Department, DepartmentDTO, Long> {

    /**
     * entity -> DTO
     *
     * @param entity
     *         待转换的实体类
     *
     * @return DTO
     */
    @Override
    @Mapping (source = "parent.id", target = "parentId")
    public abstract DepartmentDTO toDTO (Department entity);
}
